home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1986 February / Ahoy_Magazine_86-02_1986_Double_L.d64 / making change 2 (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  370b  |  16 lines

  1. 0 rem << cd26-1b >>
  2. 100 rem  problem #22-1 : making change
  3. 110 :
  4. 120 rem  paul t. dawson
  5. 130 :
  6. 140 input "amount of money (cents)";x
  7. 150 input "number of coins";y
  8. 160 for q = int((x-y)/24) to 0 step -1
  9. 170 for d = 0 to 100
  10. 180 n = (x-y-(24*q)-(9*d))/4
  11. 190 p = y - (q+d+n)
  12. 200 if q>=0 and n>=0 and p>=0 and n=int(n) then print "q"q"d"d"n"n"p"p
  13. 210 if n > 0 then next d
  14. 220 next q : print "finished"
  15. 230 p = y - (q+d+n)
  16.